<?php
//<--- * User * --->
$count = count( $this->data );

//<--- * Last Photos And Videos * --->
$countPhotosVideos = count( $this->lastPhotosVideos );

if( isset( $this->data ) &&  $count != 0 && $this->checkBlocked[0]['status'] != 1 ) :

//<-- Posts
$countPost = count( $this->posts );

//<<-- Favorites
$countFavs = count( $this->postsFavs );

//<<<-- Followers
$countFollowers = count( $this->_getFollowers );

//<<<-- Following
$countFollowing = count( $this->_getFollowing );

//<<<<- * USER BLOCK * --->>>
//<<<-- Following
$countBlock = count( $this->checkBlock );

if( $countBlock == 1 && $this->checkBlock[0]['status'] == 1 ) {
	$user_bloqueado = $_SESSION['LANG']['unlock_user'];
} else {
	$user_bloqueado = $_SESSION['LANG']['block_user'];
}
//<<<--- * Count Data * --->>>
if( $_GET['action'] == 'favorites' ) {
	$countData = $countFavs;
} else if( $_GET['action'] == 'followers' ) {
	$countData = $countFollowers;
} else if( $_GET['action'] == 'following' ) {
	$countData = $countFollowing;
} else {
	$countData = $countPost;
}
//<<<--- * Action Url * --->>>
if( isset( $_GET['action'] ) ) {
	$actionUrl = '/'.$_GET['action'];
}

/*
 * **************
 *  HEADER
 * **************
 */
include 'views/inc/header.php'; ?>
<link rel="canonical" href="<?php echo URL_BASE.$this->info->username.$actionUrl ?>">
<style>

	body {
		background-position: <?php echo $this->info->bg_position; ?> 55px;
		background-attachment: <?php echo $this->info->bg_attachment; ?>;

		<?php if( $this->info->bg_attachment == 'fixed' ): ?>
		background-repeat: repeat repeat;
		<?php else: ?>
		background-repeat: no-repeat;
		<?php endif; ?>

		background-color: <?php echo $this->info->bg_color; ?>;

		<?php if( $this->info->bg != '' ): ?>
		background-image: url(<?php echo URL_BASE.'public/backgrounds/'.$this->info->bg; ?>);
		<?php endif; ?>
	}

	body a,
	body a:hover { color: <?php echo $this->info->color_link; ?>; }
	.icons { background-color: <?php echo $this->info->color_link; ?>;}
	.container_data_profile a:hover span{ color: <?php echo $this->info->color_link; ?>;  }

	/* PopOut Message User */
	#container_popout_message { display: none; width: 100%; height: 100%; background: #000; opacity: 0.8; position: fixed; z-index: 9999;  }
	.popoutUser_message     { top: 20%; -webkit-box-shadow: 0 0 10px #1F1E1E; box-shadow: 0 0 10px #1F1E1E; display: none; max-width: 550px; padding: 0; background:#F8F8F8; color: #999; font-size: 12px;
	border-radius: 4px; -webkit-border-radius: 4px; position: fixed;  z-index: 10000; overflow: hidden; width: 80.857%; text-align: center; font-weight: bold; }
	/* top: 20%; */
	.wrap_popout_message { width: 100%; overflow: hidden; display: block; }
	.title_popout_message { -webkit-box-shadow: inset 0 -10px 20px #F3F3F3; box-shadow: inset 0 -10px 20px #F3F3F3; background: #ececec; color: #333; border-bottom: 1px solid #DDD; height: 35px; }
	.close_popout_message { position: absolute; right: 0; opacity: 0.7; width: 22px; height: 22px; margin-top: 5px; margin-right: 10px; background : url('<?php echo $_layoutParams['root_img']; ?>close.png') no-repeat; float: right; cursor: pointer;  }
	.close_popout_message:hover { opacity: 1; }
	.content_user_message {  width: 100%; float: left; padding: 0 0 10px 0; }
	.textPopout_message { width: 100%; font-size: 12px; color: #414141; float: left; display: block; padding: 0; line-height: 35px; }



</style>
<link href="<?php echo $_layoutParams['root_css']; ?>colorbox.css" rel="stylesheet" />
<link href="<?php echo $_layoutParams['root_css']; ?>jquery-ui-1.8.2.custom.css" rel="stylesheet" />
</head>
<!-- Body -->
<body data-max="<?php echo MAX_LENGTH; ?>" data-accept="<?php echo $_SESSION['LANG']['accept']; ?>" data-cancel="<?php echo $_SESSION['LANG']['cancel']; ?>">
		<?php include 'views/inc/profile_summary_inc.php'; ?>

		<!-- PopOut Message User -->
	<div id="container_popout_message"></div>
		<div class="popoutUser_message" id="content_popout_message">
			<div class="wrap_popout_message">
				<div class="title_popout_message">
					<span class="textPopout_message"></span>
					<div class="close_popout_message"></div>
				</div>
				<div class="content_user_message">
				</div><!-- content user -->
			</div><!-- wrap popout -->
		</div>
	<!-- Message user -->

		<!-- warpper_top_bar -->
		<div class="warpper_top_bar">
				<!-- inner_top_bar -->
				<header class="inner_top_bar">
					<!-- padding_class -->
					<div class="padding_class">
						<a href="<?php echo URL_BASE; ?>">
							<?php include 'views/inc/logo.php'; ?>
						</a>

					<?php include 'views/inc/navigation.php'; ?>
			    </div><!-- padding_class -->
			</header><!-- inner_top_bar -->
		</div><!-- warpper_top_bar -->

	<!-- page -->
	<div class="page">
		<!-- layout -->
		<section class="layout session">
			<div class="popout"></div>

    <!-- wrapper_grid -->
    <div style="margin-top: 15px">
            <div class="wrapper_grid floatLeft banner_left">

                <!--end update profile form -->

                <!--end update profile form -->



                <?php include 'views/inc/advertising_left.php'; ?>
			   </div><!-- wrapper_grid -->


			   <!-- Grid 2 -->
			   <div class="grid_2 floatLeft content_center">
			   	<!-- nav_profile -->
                   <?php include('views/inc/gridprofile.php') ?>

    			    <h4 class="titleBar"><?php echo $this->titleH4; ?></h4>

			   	<ul class="posts">
			   		<div id="container-loader">
			   			<div class="loading-bar"></div>
			   		</div>
			   	</ul><!-- UL POST -->

		</div><!-- Grid 2 -->

                <!-- wrapper_grid -->
                <div class="wrapper_grid floatRight  banner_right">

                    <?php
                    //<---- * advertising * --->
              //      include 'views/inc/advertising_right.php';
                    //<---- * who_follow * --->
                    //  include 'views/inc/who_to_follow.php';
                    //<---- * trending * --->
                    include('views/inc/advertising_right.php');
                    ?>

                </div><!-- wrapper_grid -->

			 </div><!-- padding_class -->
    </div>
		</section><!-- layout -->
        <!-- Grid 1 -->
        <div style="clear: both"></div>
        <div class="grid_1 footer_new" style="width: 100%;float: left">
            <!-- container_grid -->
            <div class="container_grid about_pages">
                <?php include 'views/inc/footer_session.php'; ?>
            </div><!-- container_grid -->
        </div><!-- Grid 1 -->

    </div><!-- page -->

		<div class="modal">
		<div id="content_modal">
		</div>
	</div>


        <script src="<?php echo $_layoutParams['root_js']; ?>jquery-1.7.1.min.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery.easing.1.3.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery.placeholder.1.1.1.min.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery-ui-1.8.17.custom.min.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>functions.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>count.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>add.post.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery.form.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>timeago/jqueryTimeago_<?php echo $_SESSION['lang']; ?>.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery.colorbox.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>jquery.scroll.user.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>discover.timeline.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>range_slide/simple-slider.min.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>highcharts.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>modules/exporting.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>modules/data.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>rangeslider.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>rangeslider-new.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>pschecker.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>highcharts-more.js"></script>
        <script src="<?php echo $_layoutParams['root_js']; ?>modules/solid-gauge.src.js"></script>

   <?php if( !Session::get( 'authenticated' ) ) : ?>
   <script src="<?php echo $_layoutParams['root_js']; ?>login.sign.up.js"></script>
   <?php endif; ?>

 <?php if( Session::get( 'authenticated' )
 		&& $_GET['action'] == ''
 		|| Session::get( 'authenticated' )
		&& $_SESSION['authenticated'] != $this->info->id  ) : ?>

 <?php endif; ?>

 <script type="text/javascript">


 $(".media_galery").colorbox({
   	rel:'galery'
   	});
   	$(".youtube").colorbox({iframe:true, innerWidth:640, innerHeight:390});
	$(".vimeo").colorbox({iframe:true, innerWidth:500, innerHeight:409});
	$(".soundcloud").colorbox({iframe:true, innerWidth:500, innerHeight:160, height: false });


   	$(".galeryAjax").colorbox({
   		imgError : '<?php echo $_SESSION['LANG']['image_error']; ?>'
   	});

   	$(".galeryAvatar").colorbox({
   		height: '100%',
   		imgError : '<?php echo $_SESSION['LANG']['image_error']; ?>'
   	});


   $('.posts').scrollPagination({
		nop     : 10,
		offset  : 0,
		error   : '',
		delay   : 500,

		scroll  : true,
		query   : 0,
		file    :'<?php echo $this->_file; ?>',
		_userId : <?php echo $this->info->id; ?>,
		totalGlobal :  <?php echo $countData; ?>
	});

   jQuery(document).ready(function($) {

   $('#top').live('click',function()
   {
   	$('body,html').animate({ scrollTop: 0
	}, 800);
   });

	//=== PLACEHOLDER
  $(function(){
      $(':input[placeholder]').placeholder();
    });
   //====== TIME AGO

<?php if( Session::get( 'authenticated' ) ) : ?>


		$('#reply_post').live('hover', function(){
		if ($(this).data('hascharcount') == undefined) {
			$(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10 });
		}
		});

		$('#message').live('hover', function(){
		if ($(this).data('hascharcount') == undefined) {
			$(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10 });
		}
		});

     //================  * COUNTER * =============//
   $('#add_post').live('hover', function(){
		if ($(this).data('hascharcount') == undefined ) {
			$(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10, css: 'counter_2' });
		}
		});


    //=================== * UPLOAD  * ===============//
    $('#upload').live('change', function(){
	  $('<div id="loader_gif"></div>').insertBefore('#upload');
	  $('#button_add').attr({'disabled' : 'true'}).css({'opacity':'0.5','cursor':'default'});
	  $('#add_post').attr({'disabled' : 'true'}).css({'opacity':'0.5'});


			(function() {

	  		$("#form_add_post").ajaxForm({

	  		dataType : 'json',
			success:  function(e) {
				if( e ) {

					$('#add_post').removeAttr('disabled').css({'opacity':'1'});
					if( e.error == 1 ) {
						$('#loader_gif').remove();
					}

					$('#wrapper_preview').show();
					$('#container_preview').html( ''+ e.output +'' ).show();
					$('#upload').val('');

					if( e.error == 0 ) {
						$('#loader_gif').css({background:'url("<?php echo URL_BASE; ?>thumb/60-60-tmp/'+ e.photo +'") center center no-repeat #FFF'}).addClass('deletePhoto').attr( 'data',e.photo ).attr( 'title','<?php echo $_SESSION['LANG']['delete_image']; ?>' );
						$('#wrapper_preview').show();
						$('#photoId').val(e.photo);
						$('#button_add').removeAttr('disabled').css({'opacity':'1','cursor':'pointer'});
					}

				}
				else {
					jAlert('<?php echo $_SESSION['LANG']['error']; ?>');
					$('#upload').val('');
					$('#button_add').removeAttr('disabled').css({'opacity':'1','cursor':'pointer'});
					$('#add_post').removeAttr('disabled').css({'opacity':'1'});
					$('#loader_gif').remove();


				}
			}//<----- SUCCESS

		}).submit();
		})(); //<--- FUNCTION %
	});//<--- LIVE

		//===== DELETE PHOTO
		$(".deletePhoto").live('click',function(){
					//=== PARAM
					var element     = $(this);
					var id          = element.attr("data");
					var info        = 'token_id=' + id;
					var add_post_   = $('#add_post').val();
					var video_link_ = $('#video_link').val();
					var song_link_ = $('#song_link').val();

					$.ajax({
					   type: "GET",
					   url: "<?php echo URL_BASE; ?>public/ajax/delete_id_photo.php",
					   data: info,
					   success: function(output){
					   if( output == 'TRUE' ) {
					   	if( add_post_ == 0 && video_link_ == 0 && song_link_ == 0 ) {
					   		$('#button_add').attr({'disabled' : 'true'}).css({'opacity':'0.5','cursor':'default'});
					   	}

					   	$('#photoId').val('');
					   	element.fadeOut('fast',function(){
				   		  element.remove();
				   		});//<-- FUNCTION
					   }

					 }

				});//<-- AJAX
			});//<--- CLICK

     <?php endif; ?>


});//<-------- * DOM * ------>

  </script>

	</body>
</html>
  <?php
else:

	header ('HTTP/1.0 404 Not Found');
	include 'public/error/404.php'; // SHOW ERROR 404
	exit;
	endif;//<-- COUNT - 0 Result ?>
